/**
 * Created by Administrator on 2017/8/24.
 */
import  {createStore,applyMiddleware,compose} from  'redux';
import thunk from 'redux-thunk';
import reducers from '../reducers';
import {createLogger} from 'redux-logger';

const logger = createLogger();
//中间件数组
let middleware = [thunk,logger];
//组合新的Store （支持异步，日志）
const composedCreateStore = compose(
    //添加中间件
    applyMiddleware(thunk,logger),
    window.devToolsExtension && window.devToolsExtension()
)(createStore)

export default function configureStore(initialState) {
    const store = composedCreateStore(reducers,initialState);
    return store;
}